#ifndef TEXTBUBBLE_H
#define TEXTBUBBLE_H

#include "bubbleframe.h"

#include <QTextEdit>
#include <QHBoxLayout>

// 文本聊天框
class TextBubble : public BubbleFrame
{
    Q_OBJECT
public:
    TextBubble(ChatRole role, const QString &text, QWidget *parent = nullptr);

protected:
    bool eventFilter(QObject *watched, QEvent *event);

private:
    // 在拉伸聊天界面时，自动调整消息的长度以及高度
    void adjustTextHeight();
    void setPlainText(const QString &text);
    void initStyleSheet();

private:
    QTextEdit *m_pTextEdit;
};

#endif // TEXTBUBBLE_H
